<div class="widget flat">
    <div class="widget-body">
        <div style="height: 10px;"></div>
        <div id="horizontal-form">
            <form role="form" class="form-horizontal form-spec">
                <div class="form-group no-margin-left no-margin-right">
                    <label class="col-sm-3 control-label no-padding-right" for="inputEmail3">规格名称：</label>
                    <div class="col-sm-9">
                        <input type="text" id="spec_name" class="form-control input-sm">
                    </div>
                </div>
                <div class="form-group no-margin-left no-margin-right">
                    <label class="col-sm-3 control-label no-padding-right" for="inputPassword3">显示备注：</label>
                    <div class="col-sm-9">
                        <input type="text"  id="spec_show" class="form-control input-sm">
                    </div>
                </div>
                <div class="form-group no-margin-left no-margin-right">
                    <label class="col-sm-3 control-label no-padding-right" for="inputPassword3"></label>
                    <div class="col-sm-9">
                        <a class="btn btn-default btn-sm" id="spec_add">添加</a>
                    </div>
                </div>
                <div class="form-group no-margin-left no-margin-right">
                    <label class="col-sm-3 control-label no-padding-right" for="inputPassword3"></label>
                    <div class="col-sm-9">
                        <table class="table table-bordered table-hover table-center">
                            <thead>
                            <tr>
                                <th>规格值</th>
                                <th>操作</th>
                            </tr>
                            </thead>
                            <tbody></tbody>
                        </table>
                    </div>
                </div>
            </form>
        </div>
    </div>
</div>
<script type="text/html" id="add_spec_tpl">
    <tr>
        <td><input class="input-xs spec_value" type="text" name="spec_value[]"></td>
        <td>
            <a href="javascript:void(0);" class="btn btn-danger btn-xs shiny icon-only white btn-del">删除</a>
        </td>
    </tr>
</script>
<script>
    $(function(){
        $('#spec_add').click(function(){
            var tbody = $(this).parents('form').find('table tbody');
            tbody.append(template('add_spec_tpl'));
            tbody.children(':last-child').find('.btn-del').bind('click',function(){
                var tr = $(this).closest('tr');
                if(confirm('确定要删除么?')){
                    tr.remove();
                }
            });
        });
    });
</script>